package com.ai.flight.business.data;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class BookingData {

	public static BookingData initData() {
		BookingData data = new BookingData();

		List<String> names = List.of("徐庶", "诸葛", "百里", "楼兰", "庄周");
		List<String> airportCodes = List.of("北京", "上海", "广州", "深圳", "杭州", "南京", "青岛", "成都", "武汉", "西安", "重庆", "大连",
				"天津");
		Random random = new Random();

		for (int i = 0; i < 5; i++) {
			String name = names.get(i);
			int size = airportCodes.size();
			String from = airportCodes.get(random.nextInt(size));
			String to = airportCodes.get(random.nextInt(size));
			BookingClass bookingClass = BookingClass.values()[random.nextInt(BookingClass.values().length)];

			Customer customer = new Customer();
			customer.setName(name);

			LocalDate localDate = LocalDate.now().plusDays(2 * (i + 1));

			Booking booking = new Booking("10" + (i+1), localDate, customer, BookingStatus.CONFIRMED, from, to, bookingClass);

			customer.getBookings().add(booking);

			data.getBookings().add(booking);
			data.getCustomers().add(customer);
		}
		return data;
	}
	private List<Customer> customers = new ArrayList<>();

	private List<Booking> bookings = new ArrayList<>();

	public List<Customer> getCustomers() {
		return customers;
	}

	public void setCustomers(List<Customer> customers) {
		this.customers = customers;
	}

	public List<Booking> getBookings() {
		return bookings;
	}

	public void setBookings(List<Booking> bookings) {
		this.bookings = bookings;
	}

}
